
import 'package:flutter/material.dart';

class RouterDemo extends StatefulWidget {
  const RouterDemo({Key? key}) : super(key: key);

  @override
  State<RouterDemo> createState() => _RouterDemoState();
}

class _RouterDemoState extends State<RouterDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("第一个页面"),
      ),
      body: Padding(
        padding: const EdgeInsets.fromLTRB(0,120,0,0),
        child: Container(
          child: Column(
            children: [
                 FlatButton(
                  onPressed: (){
                    // 跳转到第二页 只需要调用Navigator 的push方法
                    Navigator.of(context).pushNamed("/scend");
                  },
                  child: Text("点击跳转到第二页"),
                ),
               const SizedBox(height: 20.0),
               const Text("Navigator.of(context).pushNamed('/scend');")
               
            ],
          ),
          
        ),
      ),
      
     
    );
    
  }
}